home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / f1ocx / vcform1.2 / VB4 / FORMAT1 / FORMAT1.TXT < prev    next >
Encoding:
Text File  |  1995-09-15  |  21.5 KB  |  624 lines

  1. Attribute VB_Name = "Cell_Formatting"
  2. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  3. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  4. ''
  5. '' Cell_Formatting Module for Visual Basic 4
  6. ''
  7. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  8. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  9. Option Explicit
  10.  
  11. '' Constants for the Format types
  12. Global Const SIMPLE = 0
  13. Global Const CLASSIC1 = 1
  14. Global Const CLASSIC2 = 2
  15. Global Const CLASSIC3 = 3
  16. Global Const ACCOUNTING1 = 4
  17. Global Const ACCOUNTING2 = 5
  18. Global Const ACCOUNTING3 = 6
  19. Global Const COLORFUL1 = 7
  20. Global Const COLORFUL2 = 8
  21. Global Const COLORFUL3 = 9
  22. Global Const COLORFUL4 = 10
  23. Global Const LIST1 = 11
  24. Global Const LIST2 = 12
  25. Global Const LIST3 = 13
  26. Global Const EFFECTS3D1 = 14
  27. Global Const EFFECTS3D2 = 15
  28.  
  29. Public Sub FormatCells(SS As Object, how%)
  30. '' This routine formats the sheet. A little extra work is done so it will
  31. '' be easy to apply this code to any selection.
  32.    Dim hdrRange$, ftrRange$, col1Range$, bodyRange$, savedSelection$, i&
  33.  
  34.    With SS
  35.       '' To make this work with any selection you will want to enable
  36.       '' selections, scrollbars, and remove the following line.
  37.       .SetSelection 2, 2, 8, 6
  38.       '' Clear all formats
  39.       .EditClear 2
  40.       hdrRange = GetHdrRangeFromSelection(SS)
  41.       ftrRange = GetFtrRangeFromSelection(SS)
  42.       col1Range = GetCol1RangeFromSelection(SS)
  43.       bodyRange = GetBodyRangeFromSelection(SS)
  44.  
  45.       '' All functions below preserve the initial seleciton
  46.       Select Case how
  47.          Case SIMPLE:     ' Simple
  48.             Call TopMediumBorder(SS, hdrRange, 0)
  49.             Call BottomMediumBorder(SS, ftrRange, 0)
  50.             Call TopThinBorder(SS, ftrRange, 0)
  51.             Call BottomThinBorder(SS, hdrRange, 0)
  52.             Call AdjustFont(SS, hdrRange, 0, True, False, False)
  53.             Call AlignCenter(SS, hdrRange)
  54.  
  55.          Case CLASSIC1:     ' Classic 1
  56.             Call TopMediumBorder(SS, hdrRange, 0)
  57.             Call BottomMediumBorder(SS, ftrRange, 0)
  58.             Call TopThinBorder(SS, ftrRange, 0)
  59.             Call BottomThinBorder(SS, hdrRange, 0)
  60.             Call RightThinBorder(SS, col1Range, 0)
  61.             Call AdjustFont(SS, hdrRange, 0, False, True, False)
  62.             Call AlignCenter(SS, hdrRange)
  63.  
  64.          Case CLASSIC2:     ' Classic 2
  65.             Call TopMediumBorder(SS, hdrRange, 0)
  66.             Call BottomMediumBorder(SS, ftrRange, 0)
  67.             Call TopThinBorder(SS, ftrRange, 0)
  68.             Call BottomThinBorder(SS, hdrRange, 0)
  69.             Call SetSolidPattern(SS, col1Range, .PaletteEntry(15), 0)
  70.             Call SetSolidPattern(SS, hdrRange, .PaletteEntry(13), 0)
  71.             Call AdjustFont(SS, hdrRange, RGB(255, 255, 255), False, False, False)
  72.             Call AdjustFont(SS, col1Range, 0, True, False, False)
  73.             Call AlignCenter(SS, hdrRange)
  74.  
  75.          Case CLASSIC3:     ' Classic 3
  76.             Call TopMediumBorder(SS, hdrRange, 0)
  77.             Call BottomMediumBorder(SS, hdrRange, 0)
  78.             Call TopMediumBorder(SS, ftrRange, 0)
  79.             Call BottomMediumBorder(SS, ftrRange, 0)
  80.             Call OutlineMediumBorder(SS, .Selection, 0)
  81.             Call SetSolidPattern(SS, col1Range, .PaletteEntry(15), 0)
  82.             Call SetSolidPattern(SS, bodyRange, .PaletteEntry(15), 0)
  83.             Call SetSolidPattern(SS, hdrRange, .PaletteEntry(11), 0)
  84.             Call SetSolidPattern(SS, ftrRange, .PaletteEntry(2), 0)
  85.             Call AdjustFont(SS, hdrRange, RGB(255, 255, 255), True, True, False)
  86.             Call AlignRight(SS, hdrRange)
  87.  
  88.          Case ACCOUNTING1:
  89.             Call TopThinBorder(SS, ftrRange, 0)
  90.             Call BottomThinBorder(SS, hdrRange, 0)
  91.             Call BottomDoubleBorder(SS, ftrRange, 0)
  92.             Call AdjustFont(SS, hdrRange, QBColor(2), True, True, False)
  93.             Call AlignRight(SS, hdrRange)
  94.             Call SetNumberFormat(SS, bodyRange, "#,##0.00_);(#,##0.00)")
  95.             Call SetNumberFormat(SS, ftrRange, "$ #,##0.00_);($ #,##0.00)")
  96.             savedSelection = .Selection
  97.             .SetSelection .SelStartRow + 1, .SelStartCol + 1, .SelStartRow + 1, .SelEndCol
  98.             Call SetNumberFormat(SS, .Selection, "$ #,##0.00_);($ #,##0.00)")
  99.             .Selection = savedSelection
  100.  
  101.          Case ACCOUNTING2:
  102.             Call TopThickBorder(SS, hdrRange, .PaletteEntry(13))
  103.             Call BottomThickBorder(SS, ftrRange, .PaletteEntry(13))
  104.             Call TopThinBorder(SS, ftrRange, .PaletteEntry(13))
  105.             Call BottomThinBorder(SS, hdrRange, .PaletteEntry(13))
  106.             Call AlignRight(SS, hdrRange)
  107.             Call SetNumberFormat(SS, bodyRange, "#,##0.00_);(#,##0.00)")
  108.             Call SetNumberFormat(SS, ftrRange, "$ #,##0.00_);($ #,##0.00)")
  109.             savedSelection = .Selection
  110.             .SetSelection .SelStartRow + 1, .SelStartCol + 1, .SelStartRow + 1, .SelEndCol
  111.             Call SetNumberFormat(SS, .Selection, "$ #,##0.00_);($ #,##0.00)")
  112.             .Selection = savedSelection
  113.  
  114.          Case ACCOUNTING3:
  115.             Call BottomMediumBorder(SS, hdrRange, .PaletteEntry(13))
  116.             savedSelection = .Selection
  117.             .SetSelection .SelEndRow, .SelStartCol + 1, .SelEndRow, .SelEndCol
  118.             Call TopThinBorder(SS, .Selection, 0)
  119.             Call BottomDoubleBorder(SS, .Selection, 0)
  120.             .Selection = savedSelection
  121.             Call AdjustFont(SS, hdrRange, 0, False, True, False)
  122.             Call AdjustFont(SS, col1Range, 0, False, True, False)
  123.             Call AlignRight(SS, hdrRange)
  124.             Call SetNumberFormat(SS, bodyRange, "#,##0.00_);(#,##0.00)")
  125.             Call SetNumberFormat(SS, ftrRange, "$ #,##0.00_);($ #,##0.00)")
  126.             savedSelection = .Selection
  127.             .SetSelection .SelStartRow + 1, .SelStartCol + 1, .SelStartRow + 1, .SelEndCol
  128.             Call SetNumberFormat(SS, .Selection, "$ #,##0.00_);($ #,##0.00)")
  129.             .Selection = savedSelection
  130.  
  131.          Case COLORFUL1:     ' Colorful 1
  132.             Call BottomThinBorder(SS, .Selection, .PaletteEntry(8))
  133.             Call SetSolidPattern(SS, .Selection, .PaletteEntry(14), 0)
  134.             Call SetSolidPattern(SS, col1Range, .PaletteEntry(11), 0)
  135.             Call SetSolidPattern(SS, hdrRange, 0, 0)
  136.             Call OutlineMediumBorder(SS, .Selection, .PaletteEntry(14))
  137.             Call AdjustFont(SS, .Selection, RGB(255, 255, 255), False, False, False)
  138.             Call AdjustFont(SS, col1Range, RGB(255, 255, 255), True, True, False)
  139.             Call AdjustFont(SS, hdrRange, RGB(255, 255, 255), True, True, False)
  140.             Call AlignCenter(SS, hdrRange)
  141.  
  142.          Case COLORFUL2:     ' Colorful 2
  143.             Call TopMediumBorder(SS, hdrRange, 0)
  144.             Call BottomMediumBorder(SS, ftrRange, 0)
  145.             Call TopThinBorder(SS, ftrRange, 0)
  146.             Call BottomThinBorder(SS, hdrRange, 0)
  147.             Call SetHatchPattern4(SS, .Selection, .PaletteEntry(6), .PaletteEntry(2))
  148.             Call SetSolidPattern(SS, hdrRange, .PaletteEntry(9), 0)
  149.             Call AdjustFont(SS, hdrRange, RGB(255, 255, 255), True, True, False)
  150.             Call AdjustFont(SS, col1Range, 0, True, True, False)
  151.             Call AlignRight(SS, hdrRange)
  152.  
  153.          Case COLORFUL3:    ' Colorful 3
  154.             Call SetSolidPattern(SS, .Selection, 0, 0)
  155.             Call AdjustFont(SS, .Selection, QBColor(15), False, False, False)
  156.             Call AdjustFont(SS, hdrRange, QBColor(7), True, True, False)
  157.             Call AdjustFont(SS, col1Range, QBColor(13), True, True, False)
  158.             Call AlignRight(SS, hdrRange)
  159.  
  160.          Case COLORFUL4:    ' Colorful 4
  161.             Call TopThinBorder(SS, ftrRange, 0)
  162.             Call RightThinBorder(SS, col1Range, 0)
  163.             Call OutlineMediumBorder(SS, .Selection, 0)
  164.             Call SetHatchPattern4(SS, .Selection, .PaletteEntry(6), .PaletteEntry(2))
  165.             Call SetSolidPattern(SS, hdrRange, 0, 0)
  166.             Call AdjustFont(SS, hdrRange, QBColor(14), True, True, False)
  167.             Call AdjustFont(SS, col1Range, QBColor(1), True, True, False)
  168.             Call AlignRight(SS, hdrRange)
  169.  
  170.          '' The list formats don't fit into the 5 range schema. It would
  171.          '' be better to use ranges by number instead of string.
  172.          Case LIST1:
  173.             Call OutlineThinBorder(SS, .Selection, .PaletteEntry(14))
  174.             Call SetSolidPattern(SS, hdrRange, .PaletteEntry(14), 0)
  175.             Call SetSolidPattern(SS, ftrRange, .PaletteEntry(14), 0)
  176.             For i = .SelStartRow + 1 To .SelEndRow - 1 Step 2
  177.                Call SetHatchPattern4(SS, _
  178.                   .FormatRCNr(i, .SelStartCol, False) & _
  179.                   ":" & _
  180.                   .FormatRCNr(i, .SelEndCol, False), _
  181.                   .PaletteEntry(19), .PaletteEntry(2))
  182.             Next i
  183.             For i = .SelStartRow + 2 To .SelEndRow - 1 Step 2
  184.                Call SetHatchPattern4(SS, _
  185.                   .FormatRCNr(i, .SelStartCol, False) & _
  186.                   ":" & _
  187.                   .FormatRCNr(i, .SelEndCol, False), _
  188.                   .PaletteEntry(4), .PaletteEntry(2))
  189.             Next i
  190.             Call AdjustFont(SS, hdrRange, QBColor(15), True, True, False)
  191.             Call AdjustFont(SS, ftrRange, QBColor(15), True, False, False)
  192.             Call AlignCenter(SS, hdrRange)
  193.             Call SetNumberFormat(SS, ftrRange, "$ #,##0.00_);($ #,##0.00)")
  194.  
  195.          Case LIST2:
  196.             Call OutlineThinBorder(SS, .Selection, .PaletteEntry(14))
  197.             Call TopThickBorder(SS, hdrRange, .PaletteEntry(14))
  198.             Call BottomThickBorder(SS, ftrRange, .PaletteEntry(14))
  199.             Call TopThinBorder(SS, ftrRange, 0)
  200.             Call BottomThinBorder(SS, hdrRange, 0)
  201.             Call AdjustFont(SS, hdrRange, QBColor(4), True, True, False)
  202.             Call AlignCenter(SS, hdrRange)
  203.             Call SetSolidPattern(SS, hdrRange, .PaletteEntry(15), 0)
  204.             For i = .SelStartRow + 1 To .SelEndRow - 1 Step 2
  205.                Call SetSolidPattern(SS, _
  206.                   .FormatRCNr(i, .SelStartCol, False) & _
  207.                   ":" & _
  208.                   .FormatRCNr(i, .SelEndCol, False), _
  209.                   .PaletteEntry(15), 0)
  210.             Next i
  211.             Call SetNumberFormat(SS, ftrRange, "$ #,##0.00_);($ #,##0.00)")
  212.  
  213.          Case LIST3:
  214.             Call TopMediumBorder(SS, hdrRange, .PaletteEntry(16))
  215.             Call BottomMediumBorder(SS, hdrRange, .PaletteEntry(16))
  216.             Call TopMediumBorder(SS, ftrRange, .PaletteEntry(16))
  217.             Call BottomMediumBorder(SS, ftrRange, .PaletteEntry(16))
  218.             Call AdjustFont(SS, hdrRange, .PaletteEntry(11), True, False, False)
  219.             Call AlignCenter(SS, hdrRange)
  220.  
  221.          Case EFFECTS3D1:    ' 3D Effects 1
  222.             '' Set the back color to black so the 3D effects look good
  223.             .BackColor = .PaletteEntry(15)
  224.             Call SetSolidPattern(SS, .Selection, .PaletteEntry(15), 0)
  225.             '' Here we cheat a little and convert a range string to integers by
  226.             '' setting the current selection.
  227.             savedSelection = .Selection
  228.             .Selection = bodyRange
  229.             Call Inset3DBorder(SS, .SelStartRow, .SelStartCol, .SelEndRow, .SelEndCol)
  230.             .Selection = savedSelection
  231.             Call Raised3DBorder(SS, .SelStartRow, .SelStartCol, .SelEndRow, .SelEndCol)
  232.             Call AdjustFont(SS, hdrRange, .PaletteEntry(13), True, False, False)
  233.             Call AdjustFont(SS, col1Range, 0, True, False, False)
  234.             Call AlignCenter(SS, hdrRange)
  235.  
  236.          Case EFFECTS3D2:
  237.             '' Set the back color to black so the 3D effects look good
  238.             .BackColor = .PaletteEntry(15)
  239.             Call SetSolidPattern(SS, .Selection, .PaletteEntry(15), 0)
  240.             '' Here we cheat a little and convert a range string to integers by
  241.             '' setting the current selection.
  242.             savedSelection = .Selection
  243.             .Selection = bodyRange
  244.             '' Iterate over the rows making every other one inset
  245.             For i = .SelStartRow To .SelEndRow Step 2
  246.                Call Inset3DBorder(SS, i, .SelStartCol, i, .SelEndCol)
  247.             Next i
  248.             '' Now restore the selection
  249.             .Selection = savedSelection
  250.             Call AdjustFont(SS, hdrRange, 0, True, False, False)
  251.             Call AlignCenter(SS, hdrRange)
  252.  
  253.       End Select
  254.  
  255.       '' Adjust column widths in case our number formatting made
  256.       '' some values too wide to fit in the columns.
  257.       .SetColWidthAuto .SelStartRow, .SelStartCol, .SelEndRow, .SelEndCol, True
  258.  
  259.    End With
  260.  
  261.  
  262. End Sub
  263.  
  264. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  265. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  266. ''''
  267. '''' Range Definition Functions
  268. ''''
  269. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  270. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  271.  
  272. Private Function GetHdrRangeFromSelection(SS As Object) As String
  273. '' Selection is set before calling this function
  274.  
  275.    With SS
  276.       GetHdrRangeFromSelection = _
  277.          .FormatRCNr(.SelStartRow, .SelStartCol, False) _
  278.          & ":" & _
  279.          .FormatRCNr(.SelStartRow, .SelEndCol, False)
  280.    End With
  281.  
  282. End Function
  283.  
  284. Private Function GetFtrRangeFromSelection(SS As Object) As String
  285. '' Selection is set before calling this function
  286.  
  287.    With SS
  288.       GetFtrRangeFromSelection = _
  289.          .FormatRCNr(.SelEndRow, .SelStartCol, False) _
  290.          & ":" & _
  291.          .FormatRCNr(.SelEndRow, .SelEndCol, False)
  292.    End With
  293.  
  294. End Function
  295.  
  296. Private Function GetCol1RangeFromSelection(SS As Object) As String
  297. '' Selection is set before calling this function
  298.  
  299.    With SS
  300.       GetCol1RangeFromSelection = _
  301.          .FormatRCNr(.SelStartRow, .SelStartCol, False) _
  302.          & ":" & _
  303.          .FormatRCNr(.SelEndRow, .SelStartCol, False)
  304.    End With
  305.  
  306. End Function
  307.  
  308. Private Function GetBodyRangeFromSelection(SS As Object)
  309. '' Selection is set before calling this function
  310.  
  311.    With SS
  312.       GetBodyRangeFromSelection = _
  313.          .FormatRCNr(.SelStartRow + 1, .SelStartCol + 1, False) _
  314.          & ":" & _
  315.          .FormatRCNr(.SelEndRow - 1, .SelEndCol, False)
  316.    End With
  317.  
  318. End Function
  319.  
  320. Private Sub SetNumberFormat(SS As Object, range$, nFormat$)
  321.  
  322.    Dim savedSelection$
  323.  
  324.    With SS
  325.       savedSelection = .Selection
  326.       .Selection = range
  327.       .NumberFormat = nFormat
  328.       .Selection = savedSelection
  329.    End With
  330.  
  331. End Sub
  332.  
  333. Private Sub AdjustFont(SS As Object, range$, color&, bold As Boolean, italic As Boolean, underline As Boolean)
  334.  
  335.    Dim fName$, fSize%, savedSelection$
  336.    Dim pBold As Boolean, pItalic As Boolean, pUnderline As Boolean
  337.    Dim pStrikeout As Boolean, pColor As OLE_COLOR, pOutline As Boolean, pShadow As Boolean
  338.  
  339.    With SS
  340.       savedSelection = .Selection
  341.       .Selection = range
  342.       .GetFont fName, fSize, pBold, pItalic, pUnderline, pStrikeout, pColor, pOutline, pShadow
  343.       .SetFont fName, fSize / 20, bold, italic, underline, False, color, False, False
  344.       .Selection = savedSelection
  345.    End With
  346.  
  347. End Sub
  348.  
  349. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  350. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  351. ''''
  352. '''' Alignment Functions
  353. ''''
  354. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  355. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  356.  
  357. Private Sub AlignCenter(SS As Object, range$)
  358.  
  359.    Dim savedSelection$
  360.  
  361.    With SS
  362.       savedSelection = .Selection
  363.       .Selection = range
  364.       .SetAlignment F1HAlignCenter, False, F1VAlignBottom, 0
  365.       .Selection = savedSelection
  366.    End With
  367.  
  368. End Sub
  369.  
  370. Private Sub AlignRight(SS As Object, range$)
  371.  
  372.    Dim savedSelection$
  373.  
  374.    With SS
  375.       savedSelection = .Selection
  376.       .Selection = range
  377.       .SetAlignment F1HAlignRight, False, F1VAlignBottom, 0
  378.       .Selection = savedSelection
  379.    End With
  380.  
  381. End Sub
  382.  
  383. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  384. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  385. ''''
  386. '''' Border Functions
  387. ''''
  388. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  389. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  390.  
  391. Private Sub OutlineThickBorder(SS As Object, range$, color&)
  392.  
  393.    Dim savedSelection$
  394.  
  395.    With SS
  396.       Let savedSelection = .Selection
  397.       .Selection = range
  398.       .SetBorder 5, -1, -1, -1, -1, 0, color, 0, 0, 0, 0
  399.       .Selection = savedSelection
  400.    End With
  401.  
  402. End Sub
  403.  
  404. Private Sub TopThickBorder(SS As Object, range$, color&)
  405.  
  406.    Dim savedSelection$
  407.  
  408.    With SS
  409.       Let savedSelection = .Selection
  410.       .Selection = range
  411.       .SetBorder -1, -1, -1, 5, -1, 0, 0, 0, 0, color, 0
  412.       .Selection = savedSelection
  413.    End With
  414.  
  415. End Sub
  416.  
  417. Private Sub BottomThickBorder(SS As Object, range$, color&)
  418.  
  419.    Dim savedSelection$
  420.  
  421.    With SS
  422.       Let savedSelection = .Selection
  423.       .Selection = range
  424.       .SetBorder -1, -1, -1, -1, 5, 0, 0, 0, 0, 0, color
  425.       .Selection = savedSelection
  426.    End With
  427.  
  428. End Sub
  429.  
  430.  
  431. Private Sub OutlineMediumBorder(SS As Object, range$, color&)
  432.  
  433.    Dim savedSelection$
  434.  
  435.    With SS
  436.       Let savedSelection = .Selection
  437.       .Selection = range
  438.       .SetBorder 2, -1, -1, -1, -1, 0, color, 0, 0, 0, 0
  439.       .Selection = savedSelection
  440.    End With
  441.  
  442. End Sub
  443.  
  444. Private Sub LeftMediumBorder(SS As Object, range$, color&)
  445.  
  446.    Dim savedSelection$
  447.  
  448.    With SS
  449.       Let savedSelection = .Selection
  450.       .Selection = range
  451.       .SetBorder -1, 2, -1, -1, -1, 0, color, 0, 0, 0, 0
  452.       .Selection = savedSelection
  453.    End With
  454.  
  455. End Sub
  456.  
  457. Private Sub TopMediumBorder(SS As Object, range$, color&)
  458.  
  459.    Dim savedSelection$
  460.  
  461.    With SS
  462.       Let savedSelection = .Selection
  463.       .Selection = range
  464.       .SetBorder -1, -1, -1, 2, -1, 0, 0, 0, 0, color, 0
  465.       .Selection = savedSelection
  466.    End With
  467.  
  468. End Sub
  469.  
  470. Private Sub BottomMediumBorder(SS As Object, range$, color&)
  471.  
  472.    Dim savedSelection$
  473.  
  474.    With SS
  475.       Let savedSelection = .Selection
  476.       .Selection = range
  477.       .SetBorder -1, -1, -1, -1, 2, 0, 0, 0, 0, 0, color
  478.       .Selection = savedSelection
  479.    End With
  480.  
  481. End Sub
  482.  
  483. Private Sub OutlineThinBorder(SS As Object, range$, color&)
  484.  
  485.    Dim savedSelection$
  486.  
  487.    With SS
  488.       Let savedSelection = .Selection
  489.       .Selection = range
  490.       .SetBorder 1, -1, -1, -1, -1, 0, color, 0, 0, 0, 0
  491.       .Selection = savedSelection
  492.    End With
  493.  
  494. End Sub
  495.  
  496. Private Sub RightThinBorder(SS As Object, range$, color&)
  497.  
  498.    Dim savedSelection$
  499.  
  500.    With SS
  501.       Let savedSelection = .Selection
  502.       .Selection = range
  503.       .SetBorder -1, -1, 1, -1, -1, 0, 0, 0, color, 0, 0
  504.       .Selection = savedSelection
  505.    End With
  506.  
  507. End Sub
  508.  
  509. Private Sub TopThinBorder(SS As Object, range$, color&)
  510.  
  511.    Dim savedSelection$
  512.  
  513.    With SS
  514.       Let savedSelection = .Selection
  515.       .Selection = range
  516.       .SetBorder -1, -1, -1, 1, -1, 0, 0, 0, 0, color, 0
  517.       .Selection = savedSelection
  518.    End With
  519.  
  520. End Sub
  521.  
  522. Private Sub BottomThinBorder(SS As Object, range$, color&)
  523.  
  524.    Dim savedSelection$
  525.  
  526.    With SS
  527.       Let savedSelection = .Selection
  528.       .Selection = range
  529.       .SetBorder -1, -1, -1, -1, 1, 0, 0, 0, 0, 0, color
  530.       .Selection = savedSelection
  531.    End With
  532.  
  533. End Sub
  534.  
  535. Private Sub BottomDoubleBorder(SS As Object, range$, color&)
  536.  
  537.    Dim savedSelection$
  538.  
  539.    With SS
  540.       Let savedSelection = .Selection
  541.       .Selection = range
  542.       .SetBorder -1, -1, -1, -1, 6, 0, 0, 0, 0, 0, color
  543.       .Selection = savedSelection
  544.    End With
  545.  
  546. End Sub
  547.  
  548. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  549. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  550. ''''
  551. '''' 3D Effect Functions
  552. ''''
  553. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  554. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  555.  
  556. Private Sub Inset3DBorder(SS As Object, r1&, c1&, r2&, c2&)
  557.  
  558.    Dim savedSelection$
  559.  
  560.    With SS
  561.       Let savedSelection = .Selection
  562.       .SetSelection r1, c1, r2, c2
  563.       .SetBorder 2, -1, -1, -1, -1, -1, .PaletteEntry(48), 0, 0, 0, 0
  564.       .SetSelection r1, c2, r2, c2
  565.       .SetBorder -1, -1, 2, -1, -1, 0, 0, 0, .PaletteEntry(2), 0, 0
  566.       .SetSelection r2, c1, r2, c2
  567.       .SetBorder -1, -1, -1, -1, 2, 0, 0, 0, 0, 0, .PaletteEntry(2)
  568.       .Selection = savedSelection
  569.    End With
  570.  
  571. End Sub
  572.  
  573. Private Sub Raised3DBorder(SS As Object, r1&, c1&, r2&, c2&)
  574.  
  575.    Dim savedSelection$
  576.  
  577.    With SS
  578.       Let savedSelection = .Selection
  579.       .SetSelection r1, c1, r2, c2
  580.       .SetBorder 2, -1, -1, -1, -1, -1, .PaletteEntry(2), 0, 0, 0, 0
  581.       .SetSelection r1, c2, r2, c2
  582.       .SetBorder -1, -1, 2, -1, -1, 0, 0, 0, .PaletteEntry(48), 0, 0
  583.       .SetSelection r2, c1, r2, c2
  584.       .SetBorder -1, -1, -1, -1, 2, 0, 0, 0, 0, 0, .PaletteEntry(48)
  585.       .Selection = savedSelection
  586.    End With
  587.  
  588. End Sub
  589.  
  590. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  591. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  592. ''''
  593. '''' Pattern Functions
  594. ''''
  595. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  596. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  597.  
  598. Private Sub SetSolidPattern(SS As Object, range$, fcolor&, bcolor&)
  599.  
  600.    Dim savedSelection$
  601.  
  602.    With SS
  603.       Let savedSelection = .Selection
  604.       .Selection = range
  605.       .SetPattern 1, fcolor, bcolor
  606.       .Selection = savedSelection
  607.    End With
  608.  
  609. End Sub
  610.  
  611. Private Sub SetHatchPattern4(SS As Object, range$, fcolor&, bcolor&)
  612.  
  613.    Dim savedSelection$
  614.  
  615.    With SS
  616.       Let savedSelection = .Selection
  617.       .Selection = range
  618.       .SetPattern 4, fcolor, bcolor
  619.       .Selection = savedSelection
  620.    End With
  621.  
  622. End Sub
  623.  
  624.